home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cserial.zip / 8250NSC.H < prev    next >
Text File  |  1990-04-04  |  4KB  |  140 lines

  1. /*
  2.  *                             8250NSC.H
  3.  *
  4.  *                    National SemiConducter 8250
  5.  *
  6.  *               Serial Chip Routine Defines & Globals
  7.  *
  8.  *                           Written for the
  9.  *
  10.  *                              Datalight
  11.  *                           Microsoft V 5.x
  12.  *                                TurboC
  13.  *                                  &
  14.  *                               Zortech
  15.  *
  16.  *                             C Compilers
  17.  *
  18.  *            Copyright (c) John Birchfield 1987, 1988, 1989
  19.  */
  20.  
  21. /*
  22.  *    Intel 8259a interrupt controller addresses and constants
  23.  */
  24.  
  25. # define INT_cntrl        0x20
  26. # define INT_mask         0x21
  27. # define INT_port_enable  0xEF
  28. # define EOI_word         0x20
  29.  
  30.  
  31. /*
  32.  *    Constants used to enable and disable interrupts from the
  33.  *    8250 - they are stored in PORT_command 
  34.  */
  35.  
  36. # define RX_enable        0x0D /* Enable Rcv & RLS Interrupt       */
  37. # define TX_enable        0x0E /* Enable Xmit & RLS Interrupt      */
  38. # define RX_TX_enable     0x0F /* Enable Rcv, Xmit & RLS Interrupt */
  39. # define ERROR_reset      0xF1
  40. # define LCR_DLAB         0x80
  41.  
  42.  
  43. /*
  44.  *    8250 register offsets - should be added to value in PORT_address
  45.  */
  46.  
  47. # define IER              1  /* interrupt enable offset */
  48. # define IIR              2  /* interupt identification register */
  49. # define LCR              3  /* line control register */
  50. # define MCR              4  /* modem control register */
  51. # define LSR              5  /* line status register */
  52. # define MSR              6  /* modem status register */
  53.  
  54.  
  55. /*
  56.  *    The following constants are primarily for documentaiton purposes
  57.  *    to show what the values sent to the 8250 Control Registers do to
  58.  *    the chip.
  59.  *
  60.  *
  61.  *                     INTERRUPT ENABLE REGISTER
  62.  */
  63.  
  64. # define IER_Received_Data      1
  65. # define IER_Xmt_Hld_Reg_Empty  (1<<1)
  66. # define IER_Recv_Line_Status   (1<<2)
  67. # define IER_Modem_Status       (1<<3)
  68. # define IER_Not_Used           0xF0
  69.  
  70.  
  71. /*
  72.  *                 INTERRUPT IDENTIFICATION REGISTER
  73.  */
  74.  
  75. # define IIR_receive      4
  76. # define IIR_transmit     2
  77. # define IIR_mstatus      0
  78. # define IIR_rls          6
  79. # define IIR_complete     1
  80. # define IIR_Not_Used     0xF8
  81.  
  82.  
  83. /*
  84.  *                       LINE CONTROL REGISTER
  85.  */
  86.  
  87. # define LCR_Word_Length_Mask     3
  88. # define LCR_Stop_Bits            (1<<2)
  89. # define LCR_Parity_Enable        (1<<3)
  90. # define LCR_Even_Parity          (1<<4)
  91. # define LCR_Stick_Parity         (1<<5)
  92. # define LCR_Set_Break            (1<<6)
  93. # define LCR_Divisor_Latch_Access (1<<7) /* Divisor Latch - must be set to 1
  94.                                           * to get to the divisor latches of 
  95.                                           * the baud rate generator - must
  96.                                           * be set to 0 to access the
  97.                                           * Receiver Buffer Register and
  98.                                           * the Transmit Holding Register
  99.                                           */
  100.  
  101.  
  102. /*
  103.  *                        MODEM CONTROL REGISTER
  104.  */
  105.  
  106. # define MCR_dtr          1
  107. # define MCR_rts          (1<<1)
  108. # define MCR_Out_1        (1<<2)
  109. # define MCR_Out_2        (1<<3) /* MUST BE ASSERTED TO ENABLE INTERRRUPTS */
  110. # define MCR_Loop_Back    (1<<4)
  111. # define MCR_Not_Used     (7<<1)
  112.  
  113.  
  114. /*
  115.  *                        LINE STATUS REGISTER
  116.  */
  117.  
  118. # define LSR_Data_Ready      1
  119. # define LSR_Overrun_Error   (1<<1)
  120. # define LSR_Parity_Error    (1<<2)
  121. # define LSR_Framing_Error   (1<<3)
  122. # define LSR_Break_Interrupt (1<<4)
  123. # define LSR_THR_Empty       (1<<5)  /* Transmitter Holding Register */
  124. # define LSR_TSR_Empty       (1<<6)  /* Transmitter Shift Register */
  125. # define LSR_Not_Used        (1<<7)
  126.  
  127.  
  128. /*
  129.  *                       MODEM STATUS REGISTER
  130.  */
  131.  
  132. # define MSR_Delta_CTS       1
  133. # define MSR_Delta_DSR       (1<<1)
  134. # define MSR_TERD            (1<<2)  /* Trailing Edge Ring Detect   */
  135. # define MSR_Delta_RLSD      (1<<3)  /* Received Line Signal Detect */
  136. # define MSR_CTS             (1<<4)  /* Clear to Send               */
  137. # define MSR_DSR             (1<<5)  /* Data Set Ready              */
  138. # define MSR_RD              (1<<6)  /* Ring Detect                 */
  139. # define MSR_RLSD            (1<<7)  /* Received Line Signal Detect */
  140.